package com.songlanyun.modules.offlinegoods.model.dto;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;

import javax.validation.constraints.DecimalMax;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

import com.songlanyun.common.drive.ValueObject;
import org.hibernate.validator.constraints.Length;

import com.songlanyun.common.validator.group.AddGroup;
import com.songlanyun.common.validator.group.UpdateGroup;

import lombok.Data;

/**
 * 线下商品
 *
 * @author lijiahe
 * @date 2023-02-11
 */
@Data
public class OfflineGoodsDTO implements ValueObject {

    /**
     * 主键id
     */
    @NotNull(message = "主键id不能为空", groups = {UpdateGroup.class})
    private Long id;

    /**
     * 商家id
     */
    private Long shopId;

    /**
     * 分类id
     */
    @NotNull(message = "分类不能为空", groups = {AddGroup.class, UpdateGroup.class})
    private Long typeId;

    /**
     * 所属类型 0商品 1服务
     */
    @NotNull(message = "所属类型不能为空", groups = {AddGroup.class, UpdateGroup.class})
    private Integer type;

    /**
     * 商品名称
     */
    @NotBlank(message = "商品名称不能为空", groups = {AddGroup.class, UpdateGroup.class})
    @Length(max = 50, message = "商品名称最大字数不能超过50字", groups = {AddGroup.class, UpdateGroup.class})
    private String name;

    /**
     * 售价
     */
    @DecimalMin(value = "0.01", message = "售价最小是0.01", groups = {AddGroup.class, UpdateGroup.class})
    @DecimalMax(value = "99999.0", message = "售价最大是99999.0", groups = {AddGroup.class, UpdateGroup.class})
    private BigDecimal price;

    /**
     * 原价
     */
    @DecimalMin(value = "0.01", message = "直推分润最小是0.01", groups = {AddGroup.class, UpdateGroup.class})
    @DecimalMax(value = "999999.0", message = "直推分润最大是999999.0", groups = {AddGroup.class, UpdateGroup.class})
    private BigDecimal originalPrice;

    /**
     * 图片
     */
    @NotBlank(message = "图片不能为空", groups = {AddGroup.class, UpdateGroup.class})
    private String img;

    /**
     * 详情
     */
    @Length(max = 600, message = "详情最大字数不能超过600字", groups = {AddGroup.class, UpdateGroup.class})
    private String details;

    /**
     * 详情图片(最多6张)
     */
    private List<String> detailsImages;

    /**
     * 创建者
     */
    private Long createBy;

    /**
     * 是否发布 0否 1是
     */
    @NotNull(message = "发布状态不能为空", groups = {AddGroup.class, UpdateGroup.class})
    private Integer isRelease;
}
